Skip to content

Replace JDOM2 with DomTrip for lossless POM XML editing#1466

Merged
gnodet merged 4 commits into
masterfrom
available-felidae
May 19, 2026
Merged

Replace JDOM2 with DomTrip for lossless POM XML editing#1466
gnodet merged 4 commits into
masterfrom
available-felidae

Conversation

@gnodet

@gnodet gnodet commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #1381

  • Replace org.jdom:jdom2 dependency with eu.maveniverse.maven.domtrip:domtrip-core:1.1.0
  • Implement 16 DomTrip wrapper classes mirroring the previous JDOM2 wrappers (DomTripModel, DomTripModelETL, DomTripScm, DomTripProperties, etc.)
  • Delete all JDOM2 source (18 files) and test (8 files) classes
  • Switch default ModelETL from jdom2 to domtrip
  • Add 8 new unit test classes (147 tests) covering all DomTrip wrapper classes
  • Add formatting preservation IT with byte-for-byte exact comparison
  • Fix DomTripProperties.put() to return the previous value per the Hashtable.put contract

DomTrip provides lossless XML round-tripping, preserving comments, whitespace, attribute order, quote styles, CDATA sections, and entity encoding. This eliminates the intro/outtro hacks that the JDOM2 implementation required (regex-based intro/outtro extraction, whitespace collapsing in attributes, line ending normalization).

Breaking change

The ModelETLFactory named binding changed from "jdom2-sax" to "domtrip". This is an internal extension point not exposed via public configuration — no external consumers are known to reference the old name. If you subclassed AbstractRewritePomsPhase and hardcoded "jdom2-sax", update to "domtrip".

Test plan

  • All existing tests pass (769 tests, 0 failures, 0 errors)
  • 147 new unit tests for DomTrip wrapper classes
  • Formatting preservation IT verifies byte-for-byte output (multi-line attributes, mixed tab/space indentation, inline comments, extra blank lines)
  • Full reactor build succeeds across all 6 modules
  • UTF-16 encoded POM files handled correctly
  • CDATA sections preserved during version rewrites

🤖 Generated with Claude Code

@cstamas

cstamas commented Apr 3, 2026

Copy link
Copy Markdown
Member

woohoo! 2k lines gone!

@cstamas cstamas requested a review from kwin April 3, 2026 19:12
DomTrip provides lossless XML round-tripping, preserving comments,
whitespace, attribute order, quote styles, CDATA sections, and entity
encoding. This eliminates the intro/outtro hacks required by JDOM2.

- Replace `org.jdom:jdom2` with `eu.maveniverse.maven.domtrip:domtrip-core:1.1.0`
- Implement 16 DomTrip wrapper classes mirroring the previous JDOM2 wrappers
- Delete all JDOM2 source (18 files) and test (8 files) classes
- Switch default ModelETL from `jdom2` to `domtrip`
- Add 8 new unit test classes (147 tests) covering all DomTrip wrappers
- Add formatting preservation IT with byte-for-byte comparison
- Fix `DomTripProperties.put()` to return previous value per `Hashtable.put` contract

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet force-pushed the available-felidae branch from 0bc4b06 to 566e048 Compare April 9, 2026 07:53
@gnodet gnodet marked this pull request as ready for review April 9, 2026 07:54
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gnodet and others added 2 commits May 19, 2026 15:09
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet merged commit 1372a68 into master May 19, 2026
23 of 38 checks passed
@gnodet gnodet deleted the available-felidae branch May 19, 2026 19:28
@github-actions

Copy link
Copy Markdown

@gnodet Please assign appropriate label to PR according to the type of change.

@github-actions github-actions Bot added this to the 3.3.2 milestone May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace JDom with Domtrip

3 participants